<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8"/>
    <title>修改用户</title>
    <link rel="stylesheet" type="text/css" href="css/index.css"/>
</head>
<body>
<jsp:include page="menu.jsp"/>
<div class="index-content">
    <div class="index-content-operation">
        <a class="info-detail">修改用户</a>
        <br>
        <br>
    </div>
    <br>
    <form action="UserServlet?action=edit" method="post" onsubmit="return check()">
        <input type="hidden" id="id" name="id" value="${vo.id}"/>
        
        <table class="index-content-table-add">
            <tr>
                <td width="12%">用户名：</td><td><input class="index-content-table-td-add" type="text" id="username" name="username" value="${vo.username}"/></td>
            </tr>
            <tr>
                <td width="12%">密码：</td><td><input class="index-content-table-td-add" type="text" id="password" name="password" value="${vo.password}"/></td>
            </tr>
            <tr>
                <td width="12%">姓名：</td><td><input class="index-content-table-td-add" type="text" id="realName" name="realName" value="${vo.realName}"/></td>
            </tr>
            <tr>
                <td width="12%">性别：</td><td><input name="userSex" type="radio" value="true" ${vo.userSex==true?'checked':''}/>&nbsp;&nbsp;&nbsp;男&nbsp;&nbsp;&nbsp;&nbsp;<input name="userSex" value="false" type="radio" ${vo.userSex==false?'checked':''}/>&nbsp;&nbsp;&nbsp;女</td>
            </tr>
            <tr>
                <td width="12%">备注：</td><td><textarea id="userText" name="userText" style="width: 60%; height: 100px;padding: 0px 17px;" placeholder="请输入内容......">${vo.userText}</textarea></td>
            </tr>
            <tr>
                <td width="12%">手机：</td><td><input class="index-content-table-td-add" type="text" id="userPhone" name="userPhone" value="${vo.userPhone}"/></td>
            </tr>
            <tr>
                <td width="12%">类型：</td><td><input <c:if test="${loginUser.userType == false}">disabled="disabled" title="没有权限！！！"</c:if>  name="userType" type="radio" value="true" ${vo.userType==true?'checked':''}/>&nbsp;&nbsp;&nbsp;管理员&nbsp;&nbsp;&nbsp;&nbsp;<input <c:if test="${loginUser.userType == false}">disabled="disabled" title="没有权限！！！"</c:if>  name="userType" value="false" type="radio" ${vo.userType==false?'checked':''}/>&nbsp;&nbsp;&nbsp;普通用户</td>
            </tr>
        </table>
        <br>
        <br>
        <br>
        &nbsp;&nbsp;&nbsp;<button type="submit" class="btn btn-3d btn-pill btn-success btn-sm">提交</button>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<button type="button" class="btn btn-3d btn-pill btn-success btn-sm" onclick="javascript:history.back(-1);">取消</button>
    </form>
</div>

</body>
<script type="text/javascript">
    //提交之前进行检查，如果return false，则不允许提交
    function check() {
        //根据ID获取值
        var username = document.getElementById("username").value;
        if (username == "") {
            alert("用户名不能为空");
            return false;
        }
        var password = document.getElementById("password").value;
        if (password == "") {
            alert("密码不能为空");
            return false;
        }
        // var realName = document.getElementById("realName").value;
        // if (realName == "") {
        //     alert("姓名不能为空");
        //     return false;
        // }
        // var userPhone = document.getElementById("userPhone").value;
        // if (userPhone == "") {
        //     alert("手机不能为空");
        //     return false;
        // }
        return true;
    }
</script>
</html>
